<template>
  <el-row class="tac">
    <el-col>
      <el-menu :default-active="defaultActive" class="el-menu-vertical-demo" @select="checkMethod">
        <!-- <el-menu-item index="ed2kers_list">
          <i class="el-icon-setting"></i>
          <span slot="title">图书</span>
        </el-menu-item> -->
        <el-menu-item v-for="($val, $idx) in menuList" :key="$idx" :index="$val">
          <i class="el-icon-setting"></i>
          <span slot="title">{{$val}}</span>
        </el-menu-item>
      </el-menu>
    </el-col>
  </el-row>
</template>
<script>
import apis from "@utils/apis";
export default {
  data() {
    return {
      defaultActive: 'ed2kers_list',
      menuList: [],
    }
  },

  mounted() {
    this.$nextTick(function() {
      apis.ed2kersMenuApi().then(res => {
        this.menuList = res.result.docs
        this.defaultActive = this.menuList[0]
        this.$router.push({
          name: 'ed2kers_list',
          query: {
            category: this.menuList[0],
          },
        })
      })
    })
  },

  methods: {
    checkMethod(category, keyPath) {
      console.log(category, keyPath)
      this.$router.push({
        name: 'ed2kers_list',
        query: {
          category,
        }
      })
    }
  },

}

</script>
<style>


</style>
